//Will Zepeda
//GSP-362
//SpriteInfo.h
//class that retains info for a sprite

//in D3DXSprite->Draw...the mCenter should be mCenter of texture and
//position should be where that mCenter is placed.  this determines
//which point the sprite is rotated about. also useful for sprite
//sheets.  Would be amazing if given the sprite info and cursor
//position a sprite could detect if it was clicked.

#pragma once
#include <Windows.h>
#include "Structures.h"
#include "DX include.h"

struct SpriteInfo
{
	
	XY					mCenter;//local coords
	XY					mPosOfCenter;//screen coords
	int					mWidth;
	int					mHeight;
	float				mScale;
	float				mScaleY;
	float				mOrientation;
	IDirect3DTexture9*	mpTexture;
	D3DXIMAGE_INFO		mImageInfo;
	D3DCOLOR			mColor;

	SpriteInfo(): mCenter(0), mPosOfCenter(0), mWidth(0), 
				  mHeight(0), mScale(1.0f), mScaleY(1.0f),
				  mOrientation(0.0f), mpTexture(NULL)
	{
		memset(&mImageInfo, 0, sizeof(mImageInfo));
	}
	~SpriteInfo();
	
	void loadTexture(char *);

	void	setCenter();
	XY		getCenter(){ return mCenter; }
	
	//for ship placement
	void	setPosOfCenter(POINT);
	//for tile and button placement
	void	setPosOfCenter(float, float);
	//the way it should be
	void	setPosOfCenter(int, int);
	//old way of doing things
	void	setPosOfCenter();	//ONLY CALL AFTER mCenter and GAMEPOS have been set!!!
	XY		getPosOfCenter(){ return mPosOfCenter; }

	void	setWidth(int);
	//int		getWidth(){ return mWidth; }
	void	setHeight(int);
	//int		getHeight(){ return mHeight; }
	void	setScale(float);
	void	setScale(float, float);
	//Sets the color to a chosen A, R, G, B
	void	setColor(int A, int R, int G, int B);
	inline float getScale(){ return mScale; }

	inline void	setOrientation(float aFloat){ mOrientation = aFloat; }
	inline float getOrientation(){ return mOrientation; }

	//NOTE: uses the scale factor (mScale) to check whether param coords are in sprite
	bool	inSprite(POINT);
	bool	inSprite(XY);
};